﻿@namespace BootstrapBlazor.Components
@typeparam TModel
@inherits DialogBase<TModel>
@attribute [BootstrapModuleAutoLoader("Dialog/EditDialog.razor.js", AutoInvokeInit = false, AutoInvokeDispose = false)]

<ValidateForm Model="@Model" OnValidSubmit="@OnValidSubmitAsync" DisableAutoSubmitFormByEnter="@DisableAutoSubmitFormByEnter">
    <CascadingValue Value="ItemChangedType" IsFixed="true">
        @if (BodyTemplate != null)
        {
            <div class="form-body">
                @BodyTemplate(Model)
            </div>
            <div class="form-footer">
                @RenderFooter
            </div>
        }
        else
        {
            <EditorForm TModel="TModel" Items="Items" ItemChangedType="ItemChangedType" ItemsPerRow="ItemsPerRow" RowType="RowType" LabelAlign="LabelAlign" ShowLabel="ShowLabel" ShowUnsetGroupItemsOnTop="ShowUnsetGroupItemsOnTop">
                <Buttons>
                    @RenderFooter
                </Buttons>
            </EditorForm>
        }
        <div class="form-loader fade" id="@Id">
            <Spinner Color="Color.Primary" />
        </div>
    </CascadingValue>
</ValidateForm>
